<?php 
function inject_head(){
?>
<link rel="stylesheet" type="text/css" href="css/datepicker_vista.css" /> 
<script type="text/javascript" src="jscript/datepicker.js"></script> 
<script>
	var indicator = null;
	function load_graph(form){
		var showImage = function(){
			if ($('graphContainer').getElement('img').complete) $('graphContainer').tween('opacity',1);	
			else showImage.delay(1000);
		}
		
		$('graphContainer').tween('opacity',0);	
		FBModal_loading("Loading...", "Generating graph", true, true);
		form.set('action',APP.action).set('send',{
			onSuccess: function(res){
				//alert(res);
				if (res) {
					res = res.replace(/href/gi,'onclick');
					$('graphContainer').empty().set('html', res)
						.getElements('area').each(function(item){
							item.addEvent('click', function(e){ new Event(e).stop(); })
								.href="#";
						});
				}
				showImage.delay(1000);
				FBModal_hide();
			}		 
		}).send();
		
	}
	
	function load_drillGraph(data){
		var proc = data.type==1?
			"proc=graph-drill-reward&month="+data.month+"&year="+data.year : 
			"proc=graph-drill-punishment&month="+data.month+"&year="+data.year
		FBModal_show2( APP.action , 'post', proc, true, true, null);
	}
	
	APP = {
		action: 'proc/admin/rewardPunishmentUniversitas.php',
		periode1: null,
		periode2: null
	}
	window.addEvent('domready', function(){
		load_graph($(document.forms[0]));
		APP.periode1 = dtpicker_attach0($('periode1'), {timePicker:false, format: 'F-Y', 
			maxDate: { date: <?php echo time()?>, format: 'U' },
			onClose: function(){ 
				APP.periode2.options.minDate = {date:APP.periode1.attachTo.value, format:'U'};
				APP.periode2.formatMinMaxDates();
				load_graph(document.forms[0]);
			}
		});
		APP.periode2 = dtpicker_attach0($('periode2'), {maxDate:{ date: <?php echo time()?>, format: 'U' }, 
			timePicker:false, format: 'F-Y', onClose: function(){ load_graph(document.forms[0]); } 
		});
		APP.periode2.options.minDate = {date:APP.periode1.attachTo.value, format:'U'};
	});
</script>	
<?php
}
 
include_once 'lib/config.php';
include_once 'lib/db.php';
include_once 'lib/utils/tag.php';
include_once 'model/departemen.php';

include 'view/header.php';
include 'view/admin/rewardPunishmentUniversitas/home.php';
include 'view/footer.php';